﻿using PoemGame.Management.Domain;

namespace PoemGame.Management.Repository
{
    public class PlayerRepository:IPlayerRepository
    {
        private readonly ManagementDbContext dbContext;
        public PlayerRepository(ManagementDbContext dbContext)
        {
            this.dbContext = dbContext;
        }
        public async Task Add(Player player)
        {
            await dbContext.Players.AddAsync(player);
            await dbContext.SaveChangesAsync();
        }

        public async Task Update(Player player)
        {
            dbContext.Players.Update(player);
            await dbContext.SaveChangesAsync();
        }

        public async Task Delete(Player player)
        {
            dbContext.Players.Remove(player);
            await dbContext.SaveChangesAsync();
        }
    }
}
